package com.example.demo.service.impl;

import com.example.demo.domain.Menu;
import com.example.demo.domain.Vo.MenuListVo;
import com.example.demo.mapper.MenuMapper;
import com.example.demo.service.IMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MenuServiceImpl implements IMenuService {

    @Autowired
    private MenuMapper menuMapper;

    /**
     * 查询用户
     * @param menu
     * @return
     */
    @Override
    public List<MenuListVo> selectMenu(Menu menu) {
        return menuMapper.selectMenu(menu);
    }

    /**
     * 增加菜单
     * @param menu
     */
    @Override
    public void insertMenu(Menu menu) {
        menuMapper.insertMenu(menu);
    }

    /**
     * 修改菜单
     * @param menu
     */
    @Override
    public void updateMenuById(Menu menu) { menuMapper.updateMenuById(menu);}

    /**
     * 删除菜单
     * @param menuId
     */
    @Override
    public void delMenuById(long menuId) { menuMapper.delMenuById(menuId);}

    /**
     * 查询用户菜单
     * @param userId
     */
    @Override
    public List<Menu> getByUserId(Long userId){
        return menuMapper.getByUserId(userId);
    }
}
